package com.ncloud.chnl.mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.ncloud.chnl.entity.ChnlDeposit;  
@Mapper
public interface ChnlDepositMapper{  
  
    @Select(value = { "select * from sys_chnl_deposit where chnl_id = #{chnlId}" })
    @Results({ @Result(column = "chnl_id", property = "chnlId"), @Result(column = "deposit", property = "deposit"),  
        @Result(column = "avialable_value", property = "avialableValue"),@Result(column = "state", property = "state"),
        @Result(column="create_time",property="createTime"),@Result(column="update_time",property="updateTime"),
        @Result(column="create_user",property="createUser"),@Result(column="update_user",property="updateUser"),
        @Result(column="remark",property="remark"), @Result(column = "credit_value", property = "creditValue")})
    public ChnlDeposit getChnlDeposit(Long chnlId);

    @Insert(value = {"insert into sys_chnl_deposit(chnl_id , deposit , credit_value , avialable_value , state ,"
    		+ " create_time , create_user , update_time , update_user , remark)"
    		+ " values(#{chnlId} , #{deposit} , #{creditValue} , #{avialableValue} , #{state} ,"
    		+ " #{createTime} , #{createUser} , #{updateTime} , #{updateUser} , #{remark})"})
	public int insertChnlDeposit(ChnlDeposit deposit);

    @Update(value = {"update sys_chnl_deposit set deposit=#{deposit},credit_value=#{creditValue},avialable_value=#{avialableValue},"
    		+ " update_time=#{updateTime},update_user=#{updateUser} where chnl_id = #{chnlId}"})
	public int updateChnlDeposit(ChnlDeposit deposit);

}